﻿// Decompiled with JetBrains decompiler
// Type: TaleWorlds.CampaignSystem.Settlements.ItemData
// Assembly: TaleWorlds.CampaignSystem, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E85F8C15-4DF6-4E9C-A58A-29177E40D07A
// Assembly location: D:\steam\steamapps\common\Mount & Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.CampaignSystem.dll

using System.Collections.Generic;
using TaleWorlds.SaveSystem;

#nullable disable
namespace TaleWorlds.CampaignSystem.Settlements
{
  public struct ItemData
  {
    [SaveableField(1)]
    public readonly float Supply;
    [SaveableField(2)]
    public readonly float Demand;
    [SaveableField(3)]
    public readonly int InStore;
    [SaveableField(4)]
    public readonly int InStoreValue;

    public static void AutoGeneratedStaticCollectObjectsItemData(
      object o,
      List<object> collectedObjects)
    {
      ((ItemData) o).AutoGeneratedInstanceCollectObjects(collectedObjects);
    }

    private void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
    {
    }

    internal static object AutoGeneratedGetMemberValueSupply(object o)
    {
      return (object) ((ItemData) o).Supply;
    }

    internal static object AutoGeneratedGetMemberValueDemand(object o)
    {
      return (object) ((ItemData) o).Demand;
    }

    internal static object AutoGeneratedGetMemberValueInStore(object o)
    {
      return (object) ((ItemData) o).InStore;
    }

    internal static object AutoGeneratedGetMemberValueInStoreValue(object o)
    {
      return (object) ((ItemData) o).InStoreValue;
    }

    public ItemData(float supply, float demand, int inStore, int inStoreValue)
    {
      this.Supply = supply;
      this.Demand = demand;
      this.InStore = inStore;
      this.InStoreValue = inStoreValue;
    }

    public ItemData Add(ItemData other)
    {
      return new ItemData(this.Supply + other.Supply, this.Demand + other.Demand, this.InStore + other.InStore, this.InStoreValue + other.InStoreValue);
    }

    internal ItemData AddDemand(float demandAmount)
    {
      return new ItemData(this.Supply, this.Demand + demandAmount, this.InStore, this.InStoreValue);
    }

    internal ItemData AddSupply(float supplyAmount)
    {
      return new ItemData(this.Supply + supplyAmount, this.Demand, this.InStore, this.InStoreValue);
    }

    internal ItemData AddInStore(int inStoreAmount, int value)
    {
      return new ItemData(this.Supply, this.Demand, this.InStore + inStoreAmount, this.InStoreValue + inStoreAmount * value);
    }

    internal ItemData AddSupplyDemand(float supply, float demand)
    {
      return new ItemData(this.Supply + supply, this.Demand + demand, this.InStore, this.InStoreValue);
    }
  }
}
